#include <iostream>

using namespace std;

int main() {
	int a, b, c, d, e, f, g, h;
	cin >> a >> b;
	a += b ;
	cin >> b >> c;
	b += c;
	cin >> c >> d;
	c += d;
	cin >> d >> e;
	d += e;
	cin >> e >> f;
	e += f;
	cin >> f >> g;
	f += g;
	cin >> g >> h;
	g += h;
	int x[7] = { a, b, c, d, e, f, g };
	for (int i = 1; i < 8; i++) {
		if (x[i] > 8) {
			cout << i + 1;
			return 0;
		}
	};
}